home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 011 / dirxist.arc / PWD.ASM < prev    next >
Encoding:
Assembly Source File  |  1986-06-22  |  1.4 KB  |  38 lines

  1. comment /
  2. pwd.asm--get the present working directory--returns directory path from
  3.          root without the leading backslash
  4. syntax:
  5. memvar=spac(64)
  6. load pwd
  7. call pwd with memvar
  8.                   ******** WARNING **********
  9. Russell Freeland (Synergy Corp.) 305-792-1866
  10. History: 1st beta 5-8-1986
  11.          revised to fix var length 6-22-1986
  12. /
  13. CODESEG SEGMENT BYTE PUBLIC 'CODE'
  14.       assume cs:codeseg,ds:codeseg,es:codeseg
  15.  
  16. GETDIR PROC FAR
  17.  
  18. START:
  19.         mov     si,bx                   ;move the offset of our memvar into si
  20.         mov     ah,47h                  ;to set up DOS function call "getdir"
  21.         mov     dl,0                    ;this is for the default drive
  22.         int     21h                     ;call DOS
  23.         push    es                      ;save es
  24.         push    ds                      ;need es to point to ds
  25.         pop     es
  26.         cld                             ;clear the direction flag
  27.         mov     di,bx                   ;and load di with offset of memvar
  28.         mov     al,0                    ;load al with character to find (nul)
  29.         mov     cx,64d                  ;scan up to 64 chars
  30. repe   scasb                            ;scan it
  31.         mov     byte ptr [di],' '       ;put in a space instead of nul
  32.         pop     es                      ;put it back
  33.         ret
  34. GETDIR  ENDP
  35. CODESEG ENDS
  36.         END  START
  37.  
  38.